#{extends 'common/${model.packageName}.html' /}
#{set title:'${model.comment}' /}
<div class="xn_c_contentwarp">
  <div class="xn_c_contentlist">
  #{include "${model.packageName}/${model.modulePackage}/common/leftBar.control"/}
  <div class="xn_c_content">
    <div class="xf_ht_tablelist">
      #{form @${model.packageName}.${model.modulePackage}.${model.model}Action.list(), id:'listSubmit'}
      <input type="hidden" id="currPage" name="currPage"/>
	  <input type="hidden" id="pageSize" name="pageSize"/>
      <!-- 搜索 -->
      <div class="xf_ht_search_inon">
      <div class="xf_ht_search_r">
#foreach( $field in $fieldList )
#if(${field.matchType}=="any"||${field.matchType}=="eq"||${field.matchType}=="left"||${field.matchType}=="right")
        <div class="xf_ht_search_xl">
	        <span class="search_timesp">${field.comment}：</span>
	        <input type="text" class="search_w" name="${field.field}" id="${field.field}" placeholder="请输入${field.comment}" value="${ pageBean.conditions.${field.field}}" style="width:150px">
        </div>
#elseif(${field.matchType}=="dateRange")        
        <div class="xf_ht_search_xl">
          <span class="search_timesp">${field.comment}：</span>
          <input name="beginTime_${field.field}" type="text" id="startDate" class="search_time" onclick="laydate()"  value="${ pageBean.conditions.beginTime_${field.field}}" style="cursor: pointer" value="">
          <span class="search_timesp">--</span>
          <input name="endTime_${field.field}" type="text" id="endDate" class="search_time" onclick="laydate()"  value="${ pageBean.conditions.endTime_${field.field}}" style="cursor: pointer" value="">
        </div>
#elseif(${field.matchType} == "select")
#if($field.inputValueMap)
		<div class="xf_ht_search_xl">
		<span class="search_timesp">${field.comment}：</span>
			<select name="${field.field}" class="xf_membill_selectAge" >
				<option value="">==请选择==</option>
#foreach($item in $field.inputValueMap.entrySet()) 
				<option value="$!{item.key}" #{if pageBean?.conditions?.${field.field}==$item.key} selected #{/if}>$!{item.value}</option>
#end
		   </select>
		</div>
#elseif($field.inputType == "select"&&${field.inputValueTwo} != "")
		<div class="xf_ht_search_xl">
		<span class="search_timesp">${field.comment}：</span>
			<select name="${field.field}" class="xf_membill_selectAge" >
				<option value="">==请选择==</option>
				#{ list pageBean?.conditions.${field.field}_list} 
				<option value="${ _?.id}" #{if pageBean?.conditions?.${field.field}=='1'} selected #{/if}>${ _?.${field.inputValueTwo}}</option>
				#{/list}
		   </select>
		</div>
#else
		<div class="xf_ht_search_xl">
		<span class="search_timesp">${field.comment}：</span>
			<select name="${field.field}" class="xf_membill_selectAge" >
				<option value="">==请选择==</option>
				<option value="1" #{if ${ pageBean.conditions.${field.field}}=='1'} selected #{/if}>正常</option>
		   </select>
		</div>
#end
#end
#end
        <div class="xf_ht_search_xl">
        <input type="button" class="search_button" onclick="searchSubmit();"  value="搜索">
        </div>
      </div>
      </div>
      #{/form}
      <!-- 列表内容 -->
      <div class="xn_c_content_top">
      #{table class:"xn_c_content_list", cellspacing:"0", cellpadding:"0", border:"0", tr_class_odd:"xn_tr_bj"}
      #{tr}
        #{th width:"50px"}序号#{/th}
#foreach($field in $fieldList)
#if($field.listShow == true)
        #{th width:"100px"}${field.comment}#{/th} 
#end
#end
        #{th width:"300px"}操作#{/th}
      #{/tr}
      #{list pageBean?.page}         
      #{tr tr_index:_index}
        #{td}${(pageBean?.currPage - 1)*pageBean?.pageSize + _index}#{/td}
#foreach($field in $fieldList)
#if($field.listShow == true)
#if(${field.inputType}=="select"&&${field.inputValueTwo} != "")
		#{td}${ _?.${field.columnName}_name}#{/td}
#elseif(${field.inputType}=="datetime")
		#{td}${ _?.${field.columnName}?.format('yyyy-MM-dd HH:mm:ss')}#{/td}
#elseif(${field.inputType}=="date")
		#{td}${ _?.${field.columnName}?.format('yyyy-MM-dd')}#{/td}
#else
        #{td}${ _?.${field.columnName}}#{/td}
#end
#end
#end
        #{td}
          <span>
           #{operation key:'${model.packageName}.${model.modulePackage}.${model.model}Action.show',href:"#",show_value:"详情",class:'xf_ta_onclick',onclick:"showDetails('${ _?.sign}')"/}
			</span>
        <span>
        #{operation key:'${model.packageName}.${model.modulePackage}.${model.model}Action.edit',href:"/${model.packageName}/${model.modulePackage}/${model.model}Action/editPage?sign=${ _?.sign}",show_value:"编辑",class:'xf_ta_onclick'/}
		</span>
        <span>
        #{operation key:'${model.packageName}.${model.modulePackage}.${model.model}Action.delete',href:"#",show_value:"删除",id:"delete",class:'xf_ta_onclick',onclick:"deletes('${ _?.sign}')"/}
        </span>
        #{/td}
      #{/tr}
      #{/list}
      #{/table}
      </div>
      <!-- 列表底部 -->
      <div class="xn_c_content_bottom">
        #{page currPage:pageBean.currPage,pageSize:pageBean.pageSize,totalCount:pageBean.totalCount,theme:2,style:4}
          #{/page}
        	#{operation key:'${model.packageName}.${model.modulePackage}.${model.model}Action.add',href:"/${model.packageName}/${model.modulePackage}/${model.model}Action/addPage",show_value:"添加",class:'xf_operation_htbutton'/}
      </div>
      </div>
    </div>
  </div>
</div>

<!-- 详情-弹出层 -->
<div class="xf_ht_ttc" id="xf_ht_fkzh_ttc" style="display:none;height:400px;overflow:auto;">
</div>
 

<script type="text/javascript">
  function showPage(currPage, pageSize){
    $("#currPage").val(currPage);
    $("#pageSize").val(pageSize);
    $("#listSubmit").submit();
  }
  $(function() {
    /* 高亮显示 */
	  showHighLight(1,1,1);
  });

  //详情
  function showDetails(sign) {
    $.ajax({
      url : "@{show()}",
      type : "POST",
      data : {
        "sign" : sign
      },
      success : function(data) {
        if (data.code < 0) {
          layer.alert(data.msg,1);
          
          return;
      }
      
      var ttc = $("#xf_ht_fkzh_ttc");
      ttc.html(data);
      $.layer({
        type: 1,
        area: ['500', 'auto'],
        title: '详情',
        page: {dom : ttc}
      });
        //showDiv(ttc);
      },
      error : function() {
        layer.alert("对不起，出现错误!");
      }
    });
  }
   
  //删除
  function deletes(sign) {
    if (!confirm("确认要删除？")) {
            return;
        }
    
    $.ajax({
      url : "@{delete()}",
      type : "POST",
      data : {
        "sign" : sign
      },
      success : function(data) {
        layer.alert(data.msg,1);
        
        if (data.code == 0) {
          location.reload();
        }
      },
      error : function() {
        layer.alert("对不起，出现错误!");
      }
    });
  }
  
function searchSubmit(){
  $("#listSubmit").submit();
}
</script>
